home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / headers / graphicsenv.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  3.8 KB  |  123 lines

  1. /*
  2.     File:        GraphicsEnv.h
  3.  
  4.     Contains:    GraphicsEnv is a collection of utility classes that could be used for defining grafport values
  5.                   (font, pen drawing, color).    
  6.                   GraphicsEnv.h contains the graphics environment class definitions. 
  7.  
  8.     Written by: Kent Sandvik    
  9.  
  10.     Copyright:    Copyright Â© 1993-1999 by Apple Computer, Inc., All Rights Reserved.
  11.  
  12.                 You may incorporate this Apple sample source code into your program(s) without
  13.                 restriction. This Apple sample source code has been provided "AS IS" and the
  14.                 responsibility for its operation is yours. You are not permitted to redistribute
  15.                 this Apple sample source code as "Apple sample source code" after having made
  16.                 changes. If you're going to re-distribute the source, we require that you make
  17.                 it clear in the source that the code was descended from Apple sample source
  18.                 code, but that you've made changes.
  19.  
  20.     Change History (most recent first):
  21.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  22.                 
  23.  
  24. */
  25. // Declare label for this header file
  26. #ifndef _GRAPHICSENV_
  27. #define _GRAPHICSENV_
  28.  
  29. #ifndef _DTSCPLUSLIBRARY_
  30. #include "DTSCPlusLibrary.h"
  31. #endif
  32.  
  33. // TOOLBOX INTERFACES
  34. #ifndef __QUICKDRAW__
  35. #include <Quickdraw.h>
  36. #endif
  37.  
  38.  
  39. // _________________________________________________________________________________________________________ //
  40. //    TFontEnvironment Class Interface.
  41. class TFontEnvironment
  42. // TFontEnvironment will define the font size, numver and style.
  43. {
  44. public:
  45.     // CONSTRUCTORS AND DESTRUCTORS
  46.     TFontEnvironment(short mode = srcOr,
  47.                      short fontNo = 0,
  48.                      short textSize = 0,
  49.                      Style newStyle = 0);
  50.     virtual~ TFontEnvironment();                // default destructor
  51.  
  52.     // MAIN INTERFACE
  53.     virtual void Set();                            // set font values into grafport
  54.     virtual void Reset();                        // reset the grafport concerning font values
  55.  
  56.     // FIELDS
  57. protected:
  58.     short fFont;                                // selected font
  59.     short fTextSize;                            // font size
  60.     Style fStyle;                                // font style (plain, bold, italic…)
  61.     short fMode;                                // transfer mode
  62. };
  63.  
  64.  
  65. // _________________________________________________________________________________________________________ //
  66. //    TPenEnvironment Class Interface.
  67. class TPenEnvironment
  68. // TPenEnvironment will define the pen size, pattern and mode.
  69. {
  70. public:
  71.     // CONSTRUCTORS AND DESTRUCTORS
  72.     TPenEnvironment(short mode = srcOr,
  73.                     Pattern penPattern = qd.black,
  74.                     short penWidth = 1,
  75.                     short penHigh = 1);
  76.     virtual~ TPenEnvironment();                    // default destructor
  77.  
  78.     // MAIN INTERFACE
  79.     virtual void Set();                            // set pen values in grafport
  80.     virtual void Reset();                        // reset the grafport concerning pen values
  81.  
  82.     // FIELDS
  83. protected:
  84.     short fMode;                                // mode of pen
  85.     ConstPatternParam fPattern;                    // pen pattern
  86.     short fWidth;                                // width of pen
  87.     short fHigh;                                // high of pen
  88. };
  89.  
  90.  
  91. // _________________________________________________________________________________________________________ //
  92. //    TColorEnvironment Class Interface.
  93. class TColorEnvironment
  94. // TColorEnvironment will define the grafport colors (background, foreground).
  95. {
  96. public:
  97.     // CONSTRUCTORS & DESTRUCTORS
  98.     TColorEnvironment(unsigned short red,
  99.                       unsigned short green,
  100.                       unsigned short blue);
  101.     TColorEnvironment(RGBColor theColor);        // additional constructor, takes an RGBColor struct
  102.     virtual~ TColorEnvironment();                // default destructor
  103.  
  104.     // MAIN INTERFACE
  105.     virtual void SetForeground();                // set foreground color
  106.     virtual void SetBackground();                // set background color
  107.     virtual void Reset();                        // reset grafport to black&white
  108.  
  109.     // FIELDS
  110. protected:
  111.     RGBColor fColor;                            // RGB values for our color grafport
  112. };
  113.  
  114. #endif
  115.  
  116. // _________________________________________________________________________________________________________ //
  117.  
  118. /*    Change History (most recent last):
  119.   No        Init.    Date        Comment
  120.   1            khs        1/2/93        New file
  121.   2            khs        1/7/93        Cleanup
  122. */
  123.